package com.bigShen.demo;

import java.lang.reflect.Field;

/**
 * @Auther: lei.shen
 * @Date: 2018/9/27 19:51
 * @Description:
 */
public class ReflectInteger {

    public static void main(String[] args) {

        Integer i = 1;

        //repeatInteger(i);
        repeatInteger2(i);

        System.out.println(i);
    }

    private static void repeatInteger(Integer i) {

        try {
            Field field = Integer.class.getDeclaredField("value");
            field.setAccessible(Boolean.TRUE);
            field.setInt(i, 2);
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }


    }

    private static void repeatInteger2(Integer i) {

        System.out.println(2);
        System.exit(1);
    }

}
